#ifndef _SIMP_TXT_ANALYSIS_H_
#define _SIMP_TXT_ANALYSIS_H_

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

    enum txt_cmd_format_em
    {
        TXT_CMD_TYPE_END = 0, 
        TXT_CMD_TYPE_CHAR = 1,
        TXT_CMD_TYPE_SHORT = 2,
        TXT_CMD_TYPE_LONG = 3,
        TXT_CMD_TYPE_FLOAT = 4,
        TXT_CMD_TYPE_STRING = 5,
        TXT_CMD_TYPE_NUMBER = 6, 
        TXT_CMD_TYPE_NOP = 7,
    };
    typedef enum txt_cmd_format_em txt_cmd_format_type;

    struct txt_cmd_cfg_str
    {
        uint16_t attr;              
        const char *cmd;            
        txt_cmd_format_type format; 
        void *des;                  
        uint8_t len_max;            
        void (*callback)(uint16_t cmd_site, const char *txt_src, uint16_t len, int16_t cmd_num);
        const char *read_me;
    };

    typedef struct txt_cmd_cfg_str txt_cmd_cfg_type;

    uint16_t txt_cmd_analysis(const txt_cmd_cfg_type *cmd_list, const char *txt, uint16_t txt_len_max);
    int16_t txt_cmd_line_analysis(const txt_cmd_cfg_type *cmd_list, char *buff);

    typedef struct
    {
        uint8_t *line_buff; 
        int16_t line_max;
    } txt_cmd_analysis_ctr_type;

    int16_t txt_auto_cmd_line_analysis(
        const txt_cmd_cfg_type *cmd_list,
        txt_cmd_analysis_ctr_type *ctr);

    uint16_t txt_auto_cmd_analysis(
        const txt_cmd_cfg_type *cmd_list,
        txt_cmd_analysis_ctr_type *ctr,
        const char *txt,
        uint16_t txt_len_max);

#ifdef __cplusplus
}
#endif

#endif 
